	
	package service;
	
	import java.util.ArrayList;
	import java.util.List;
	import enitys.Admin;
import Dao.AdminDao;
import Dao.daoimpl.AdminDaoImpl;
	/*
	 * java 单例原理
	 */
	public class AdminMananger {
		private AdminDao dao = new AdminDaoImpl();
		static private AdminMananger instance = null;
	
		private AdminMananger() {
	
		}
	
		static public synchronized AdminMananger getInstance() {
				if (instance == null) {
					instance = new AdminMananger();
				}
				return instance;
		}
		public boolean Addadmin(Admin admin) throws Exception {
				boolean flag = false;
				flag = dao.addAdmin(admin);
				return flag;
		}
	
		public List<Admin> findAllAdmin() throws Exception {
				List<Admin> list = new ArrayList<Admin>();
				list = dao.findAdmin();
				return list;
		}
		public List<Admin> findAllAdminById(int id) throws Exception{
			return dao.findAdminById(id);
			
		}
		public boolean  modifadmin(Admin admin) throws Exception {
			// TODO Auto-generated method stub
				return dao.modifadmin(admin);
		}
	
		public int  deleteadmin(Admin admin) throws Exception {
			// TODO Auto-generated method stub
				int result=0;
				result=dao.deleteadmin(admin);
				return result;
		}
	
	}
